package com.itbaizhan.service;

import com.itbaizhan.dao.StudentDao;
import com.itbaizhan.daomain.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
//写完service类，再配置事务
//注入spring中
@Service
public class StudentService {
    //取到dao层接口
    @Autowired
    private StudentDao studentDao;

    //查询所有学生
    public List<Student> findAll(){
        /*List<Student> all = studentDao.findAll();
        return all;*/
        return studentDao.findAll();

    }
    //新增方法
    public void addStudent(Student student){
        studentDao.add(student);
    }
}
